<?php
require_once( 'classes/class.Pagination.php' );
$iPageNum    = 1;
$iPageSize   = 10;
$iNumItems   = 3024;
$iSetSize    = 5;

$iPageNum = (!empty( $_GET['page'] )) ? $_GET['page'] : $iPageNum;
$iPageSize = (!empty( $_GET['pagesize'] )) ? $_GET['pagesize'] : $iPageSize; 

$oPagination = new Pagination( $iPageNum , $iPageSize , $iNumItems , $iSetSize );
$iStartMicrotime = microtime( true );
// There are 2 parameters. The type of pagination and the url string with the replace values
// the replace values are PAGEITEMS which is the pagesize.
$sPagination1 = $oPagination->HTML( 'running' , '?page=PAGENUM&amp;pagesize=PAGESIZE' );
$iPagination1Microtime = microtime( true );
$sPagination2 = $oPagination->HTML( 'arrows' , '?page=PAGENUM&amp;pagesize=PAGESIZE' );
$iPagination2Microtime = microtime( true );
// with pagesizes displayed
//echo $oPagination->HTML( 'arrows' , '?page=PAGENUM&pagesize=PAGESIZE' , array( 'bPageSizes' => true ) );

// Running with customised options

$sPagination3 = $oPagination->HTML( 'running' , '?page=PAGENUM&amp;pagesize=PAGESIZE' , array( 
	'sPrevious'      => 'NUMBER',
	'sFirst'         => 'NUMBER',
	'sNext'          => 'NUMBER',
	'sLast'          => 'NUMBER',
	'bPageSizes'     => true,
	'bShowPrevious'  => true,
	'bShowFirst'     => false,
	'bShowNext'      => true,
	'bShowLast'      => false,
	'bDisableLinks'  => false,
	'sOrder'         => 'FIRST,PAGENUMS,LAST,SETSIZES',
	'iSetSize'       => 3,
) );
$iPagination3Microtime = microtime( true );

$sPagination4 = $oPagination->HTML( 'running' , '?page=PAGENUM&amp;pagesize=PAGESIZE' , array( 
	'sPrevious'      => 'NUMBER',
	'sNext'          => 'NUMBER',
	'bPageSizes'     => true,
	'bShowPrevious'  => true,
	'bShowFirst'     => false,
	'bShowNext'      => true,
	'bShowLast'      => false,
	'bDisableLinks' => false,
	'sOrder'         => 'FIRST,LAST,PREV,PAGENUMS,NEXT',
	'iSetSize'       => 3,
) );
$iPagination4Microtime = microtime( true );

$sPagination5 = $oPagination->HTML( 'set' , '?page=PAGENUM&amp;pagesize=PAGESIZE' , array( 
	//'sPrevious'      => 'NUMBER',
	//'sNext'          => 'NUMBER',
	'bPageSizes'     => true,
	'bShowPrevious'  => true,
	'bShowFirst'     => true,
	'bShowNext'      => true,
	'bShowLast'      => true,
	'sOrder'         => 'FIRST,PREV,PAGENUMS,NEXT,LAST',
	'iSetSize'       => 10,
) );
$iPagination5Microtime = microtime( true );
?>
<html>
	<head>
		<title>Pagination Testing Ground</title>
		<style type="text/css">
			body{ font-family: verdana; font-size: 9pt; background: #b5b5b5; text-align: center; }
			#content{ background: #FFFFFF; width: 1000px; margin: auto; text-align:left; padding: 20px; }
			
			/* STRUCTURE */
			.pagination { 
				display: block;
				height: 20px;
				list-style: none; 
				margin: 2px; 
				padding: 7px;
			}
			.pagination li {
				display: block;
				float: left;
				padding: 2px;
				margin: 2px;
				text-align: center;
			}
			.pagination li a,
			.pagination li { 
				display: block;
				width: 35px;
				text-decoration: none;
			}
			.pagination li a:hover {
				
			}
			
			/* COLOURS */
			.pagination {
				border: 1px solid #b5b5b5; 
				background: #cccccc; 
			}
			.pagination li { 
				background: #F5F5F5;
				border: 1px solid #D9D9D9;
			}
			.pagination .page-size {
				background: #D9D9D9;
			}
			.pagination .page-size.selected {
				background: #E9E9E9;
			}
			.pagination a {
				color: #666666;
			}
			.pagination a:hover {
				color: #FF0000;
			}
			.pagination .disabled,
			.pagination .disabled a {
				color: #DDDDDD;
			}
			
			.pagination .current {
				color: #FFFFFF;
				background: #CCCC00;
			}
			
			.clear-fix { clear: both; font-size: 0px; }
		</style>
	</head>
	<body>
		<div id="content">
		<h3>Pagination Defaults</h3>		
		<?php echo $sPagination1; ?>
		<div class="clear-fix">&nbsp;</div>
		<?php echo 'Process Time: '.($iPagination1Microtime - $iStartMicrotime);?>
		<h3>Pagination Defaults with Invalid Type</h3>
		<?php echo $sPagination2; ?>
		<div class="clear-fix">&nbsp;</div>
		<?php echo 'Process Time: '.($iPagination2Microtime - $iPagination1Microtime);?>
		
		<h3>Pagination Running Set First,Last Numbered with SetSizes</h3>
		<?php echo $sPagination3; ?>
		<div class="clear-fix">&nbsp;</div>
		<?php echo 'Process Time: '.($iPagination3Microtime - $iPagination2Microtime);?>
		
		<h3>Pagination Running Set Customisation</h3>
		<?php echo $sPagination4; ?>
		<div class="clear-fix">&nbsp;</div>
		<?php echo 'Process Time: '.($iPagination4Microtime - $iPagination3Microtime);?>
		
		<h3>Pagination Block Sets</h3>
		<?php echo $sPagination5; ?>
		<div class="clear-fix">&nbsp;</div>
		<?php echo 'Process Time: '.($iPagination5Microtime - $iPagination4Microtime);?>
		<h3>Class PRINT_R</h3>
		<pre><?php 
			echo print_r( $oPagination , true ); 
		?></pre>
		</div>
	</body>
</html>
